﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace codedynamiks_mes_baguio
{
    //Class containing application constants
    static class Const
    {
        //User manager image file buffer name.
        public const string APPLICATION_EBPLS_IMG = "application_ebpls_img";
        public const string USERMANAGERIMG = "user_manager_img";
        public const string USERCURRENT = "user_current_img";
        public const string USERBACKDOOR = "backdoor";
        public const string SAVESTATE_1 = "state0";
        public const string SAVESTATE_2 = "state1";
    }
    /// <summary>
    /// Class that represents the current user.
    /// </summary>
    public static class CurrentUser
    {
        public static string UID = "";
        public static object ID = "";
        public static object STAMP = "";
        public static string PWD = "";
        public static string NAME = "";
        public static string DESIGNATION = "";
        public static System.Drawing.Bitmap IMG = codedynamiks_mes_baguio.Properties.Resources.DefaultProfile;
        public static object[] PRIV = new object[0];
        public static bool FindPrivilege(object priv)
        {
            bool found = false;
            for (int i = 0; i < PRIV.Length; i++)
            {
                if (priv.ToString() == PRIV[i].ToString())
                {
                    found = true;
                    break;
                }
            }
            return found;
        }
        public static string USERIDNUMBER
        {
            get
            {
                long n = 0;
                if (!long.TryParse(ID.ToString(), out n)) return "";
                return n.ToString("USER0000#") + "_";
            }
        }
    }
}
